package com.code.zjm.binder.demo.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.FragmentActivity;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.code.zjm.binder.demo.R;
import com.code.zjm.binder.demo.entity.Book;
import com.code.zjm.binder.demo.entity.Student;

import java.util.List;

/**
 * Created by ZJM on 2017/3/16.
 */

public class ShowBookActivity extends FragmentActivity {
    private ListView lv;
    private List<Book> books;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_show_book);
        initData();
        initView();
    }

    private void initData() {
        Student student = getIntent().getParcelableExtra("bookList");
        books = student.getBooks();

    }

    private void initView() {
        lv = (ListView) findViewById(R.id.lv);
        lv.setAdapter(new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, books));

    }
}
